let app=require("express")()
let pdcloud=require("pdcloud")(app)

app.use("/getdetail",async (req,res,next)=>{
    let seller = await pdcloud.getserverdata("user-server", {
        url: "/getseller",
        req
      })
      console.log(seller);
    if(seller.succeed) {
        seller = JSON.parse(seller.body);
    } else { //获取seller数据失败
        seller = "get seller failed";
    }

    let detail={
        seller,
        "item": {
			"itemId": "615951174561",
			"title": "现货海南妃子笑荔枝5斤热带当季新鲜水果整箱包邮桂花香鲜荔枝王",
			"subtitle": "果园现摘 当天现发 爆甜多汁",
			"images": ["//img.alicdn.com/imgextra/i3/2873292949/O1CN01vrsQCo1Xegb6mBwhz_!!2873292949.jpg", "//img.alicdn.com/imgextra/i3/2873292949/O1CN01nePIEu1Xegawqycp3_!!2873292949.jpg", "//img.alicdn.com/imgextra/i4/2873292949/O1CN01Ql4sOI1XegajeSYto_!!2873292949.jpg", "//img.alicdn.com/imgextra/i2/2873292949/O1CN019aeu3u1XegaoQefcD_!!2873292949.jpg", "//img.alicdn.com/imgextra/i4/2873292949/O1CN01Rkslmy1XegaoQfTWl_!!2873292949.jpg"],
			"categoryId": "50138004",
			"rootCategoryId": "50050359",
			"commentCount": "320",
			"favcount": "1078",
			"taobaoDescUrl": "//h5.m.taobao.com/app/detail/desc.html?_isH5Des=true#!id=615951174561&type=0&f=TB1eesHEFP7gK0jSZFj8qw5aXla&sellerType=B",
			"h5moduleDescUrl": "//mdetail.tmall.com/templates/pages/itemDesc?id=615951174561",
			"cartUrl": "https://h5.m.taobao.com/awp/base/cart.htm"
		}
    }
    res.json(detail)
})

app.use("/getdetailA",async (req,res,next)=>{
    let seller = await pdcloud.getserverdata("user-server", {
        url: "/getsellerA",
        req
      })
      console.log(seller);
    if(seller.succeed) {
        seller = JSON.parse(seller.body);
    } else { //获取seller数据失败
        seller = "get seller failed";
    }
    let detail={
        seller,
        "item": {
			"itemId": "615951174561",
			"title": "现货海南妃子笑荔枝5斤热带当季新鲜水果整箱包邮桂花香鲜荔枝王",
			"subtitle": "果园现摘 当天现发 爆甜多汁",
			"images": ["//img.alicdn.com/imgextra/i3/2873292949/O1CN01vrsQCo1Xegb6mBwhz_!!2873292949.jpg", "//img.alicdn.com/imgextra/i3/2873292949/O1CN01nePIEu1Xegawqycp3_!!2873292949.jpg", "//img.alicdn.com/imgextra/i4/2873292949/O1CN01Ql4sOI1XegajeSYto_!!2873292949.jpg", "//img.alicdn.com/imgextra/i2/2873292949/O1CN019aeu3u1XegaoQefcD_!!2873292949.jpg", "//img.alicdn.com/imgextra/i4/2873292949/O1CN01Rkslmy1XegaoQfTWl_!!2873292949.jpg"],
			"categoryId": "50138004",
			"rootCategoryId": "50050359",
			"commentCount": "320",
			"favcount": "1078",
			"taobaoDescUrl": "//h5.m.taobao.com/app/detail/desc.html?_isH5Des=true#!id=615951174561&type=0&f=TB1eesHEFP7gK0jSZFj8qw5aXla&sellerType=B",
			"h5moduleDescUrl": "//mdetail.tmall.com/templates/pages/itemDesc?id=615951174561",
			"cartUrl": "https://h5.m.taobao.com/awp/base/cart.htm"
		}
    }
    res.json(detail)
})

